home *** CD-ROM | disk | FTP | other *** search
/ The Very Best of Atari Inside / The Very Best of Atari Inside 1.iso / mint / mntlib25 / mntlib25.zoo / _fltsisf.cpp < prev    next >
Text File  |  1992-12-12  |  1KB  |  53 lines

  1. |
  2. | long integer to single float conversion routine
  3. |
  4. | Andreas Schwab (schwab@ls5.informatik.uni-dortmund.de)
  5. |  mostly copied from _floatsi.cpp
  6.  
  7. #ifndef __M68881__
  8.     .text
  9.     .even
  10.     .globl    ___floatsisf
  11.  
  12. ___floatsisf:
  13. #ifdef    sfp004
  14.  
  15. | addresses of the 68881 data port. This choice is fastest when much data is
  16. | transferred between the two processors.
  17.  
  18. comm =     -6    |    fpu command reg
  19. resp =    -16    |    fpu response reg
  20. zahl =      0    |    fpu data reg
  21.  
  22.     lea    0xfffffa50:w,a0
  23.     movew    #0x4000,a0@(comm)    | load long int to fp0
  24.     cmpiw    #0x8900,a0@(resp)    | check
  25.     movel    a7@(4),a0@
  26.     movew    #0x7400,a0@(comm)    | get double from fp0
  27. | wait loop is NOT coded directly
  28. 1:    cmpw    #0x8900,a0@(resp)
  29.     beq    1b
  30.     movel    a0@,d0
  31.     rts
  32.  
  33. #else /* !sfp004 */
  34.  
  35. BIAS4    =    0x7F-1
  36.  
  37.     moveml    d2-d5,sp@-    | save registers to make norm_sf happy
  38.  
  39.     movel    sp@(20),d4    | prepare result mantissa
  40.     movew    #BIAS4+32-8,d0    | radix point after 32 bits
  41.     movel    d4,d2        | set sign flag
  42.     swap    d2
  43.     tstw    d2        | check sign of number
  44.     bge    1f        | nonnegative
  45.     negl    d4        | take absolute value
  46. 1:
  47.     clrw    d1        | set rounding = 0
  48.     jmp    norm_sf
  49.  
  50. #endif /* !sfp004 */
  51.  
  52. #endif /* !__M68881__ */
  53.